package com.stone.framework.user.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.stone.framework.user.entity.Role;

@Mapper
public interface RoleMapper extends BaseMapper<Role> {

    @Select("SELECT SR.CODE FROM ST_ROLE_USER SRU JOIN ST_USER SU ON SU.ID = SRU.USER_ID JOIN ST_ROLE SR ON SR.ID = SRU.ROLE_ID WHERE SR.STATE = 'ENABLED' AND SU.NAME = #{username}")
    List<String> selectByUsername(String username);

}
